﻿using System;
using Orchard.ContentManagement;
using Whatsnexx.TicketBus.TicketBusClient.DataModel;

namespace Whatsnexx.Models
{
    public class WhatsnexxPart : ContentPart<WhatsnexxPartRecord>
    {
        public string EventName
        {
            get { return Record.EventName; }
            set { Record.EventName = value; }
        }

        public string SubjectTypeId
        {
            get { return Record.SubjectTypeId; }
            set { Record.SubjectTypeId = value; }
        }

        public string SubjectCode
        {
            get { return Record.SubjectCode; }
            set { Record.SubjectCode = value; }
        }

        public string Environment
        {
            get { return Record.Environment; }
            set { Record.Environment = value; }
        }

        public bool IsValid()
        {
            Guid bufferAccountId;
            return !String.IsNullOrWhiteSpace(Record.SubjectTypeId)
                   && Guid.TryParse(Record.SubjectTypeId, out bufferAccountId);
        }
    }
}